import axios from 'axios';

const adminRequest = axios.create({
    baseURL: 'http://localhost:8080/admin',
    timeout: 5000,
})


// 添加token
adminRequest.interceptors.request.use(config => {
  const token = localStorage.getItem('admin_token');
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
});

// 添加响应拦截器
adminRequest.interceptors.response.use(response => {
    return response.data;
});

export default adminRequest;



